﻿SET QUOTED_IDENTIFIER ON
GO
SET ARITHABORT ON
GO
SET NUMERIC_ROUNDABORT OFF
GO
SET CONCAT_NULL_YIELDS_NULL ON
GO
SET ANSI_NULLS ON
GO
SET ANSI_PADDING ON
GO
SET ANSI_WARNINGS ON
GO

GO
ALTER TABLE dbo.bht_Columns SET (LOCK_ESCALATION = TABLE)
GO
CREATE TABLE dbo.bht_ColumnsEditConfiguration
	(
	ColumnId int NOT NULL,
	Configuration nvarchar(4000) NOT NULL
	)  ON [PRIMARY]
GO
ALTER TABLE dbo.bht_ColumnsEditConfiguration ADD CONSTRAINT
	PK_bht_ColumnsEditConfiguration PRIMARY KEY CLUSTERED 
	(
	ColumnId
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

GO
ALTER TABLE dbo.bht_ColumnsEditConfiguration ADD CONSTRAINT
	FK_bht_ColumnsEditConfiguration_bht_Columns FOREIGN KEY
	(
	ColumnId
	) REFERENCES dbo.bht_Columns
	(
	ColumnId
	) ON UPDATE  NO ACTION 
	 ON DELETE  NO ACTION 
	
GO
ALTER TABLE dbo.bht_ColumnsEditConfiguration SET (LOCK_ESCALATION = TABLE)
GO

GO

CREATE PROCEDURE [dbo].[bhp_NemoColumnsEditConfiguration]
	@ColumnId				INT
AS
BEGIN

	SELECT
		[Configuration]
	FROM
		dbo.bht_ColumnsEditConfiguration
	WHERE
		ColumnId = @ColumnId
	
END

GO
